package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbCompanyReliadbility;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbCompanyReliadbilityMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbCompanyReliadbility> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbCompanyReliadbilityResult")
    TbCompanyReliadbility selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbCompanyReliadbilityResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="machine_score", property="machineScore", jdbcType=JdbcType.REAL),
        @Result(column="reliability", property="reliability", jdbcType=JdbcType.VARCHAR),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbCompanyReliadbility> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .where(TbCompanyReliadbilityDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbCompanyReliadbility record) {
        return insert(SqlBuilder.insert(record)
                .into(TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .map(TbCompanyReliadbilityDynamicSqlSupport.organId).toProperty("organId")
                .map(TbCompanyReliadbilityDynamicSqlSupport.machineScore).toProperty("machineScore")
                .map(TbCompanyReliadbilityDynamicSqlSupport.reliability).toProperty("reliability")
                .map(TbCompanyReliadbilityDynamicSqlSupport.inputTime).toProperty("inputTime")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbCompanyReliadbility record) {
        return insert(SqlBuilder.insert(record)
                .into(TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .map(TbCompanyReliadbilityDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbCompanyReliadbilityDynamicSqlSupport.machineScore).toPropertyWhenPresent("machineScore", record::getMachineScore)
                .map(TbCompanyReliadbilityDynamicSqlSupport.reliability).toPropertyWhenPresent("reliability", record::getReliability)
                .map(TbCompanyReliadbilityDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCompanyReliadbility>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbCompanyReliadbilityDynamicSqlSupport.id, TbCompanyReliadbilityDynamicSqlSupport.organId, TbCompanyReliadbilityDynamicSqlSupport.machineScore, TbCompanyReliadbilityDynamicSqlSupport.reliability, TbCompanyReliadbilityDynamicSqlSupport.inputTime)
                .from(TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbCompanyReliadbility>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbCompanyReliadbilityDynamicSqlSupport.id, TbCompanyReliadbilityDynamicSqlSupport.organId, TbCompanyReliadbilityDynamicSqlSupport.machineScore, TbCompanyReliadbilityDynamicSqlSupport.reliability, TbCompanyReliadbilityDynamicSqlSupport.inputTime)
                .from(TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbCompanyReliadbility selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbCompanyReliadbilityDynamicSqlSupport.id, TbCompanyReliadbilityDynamicSqlSupport.organId, TbCompanyReliadbilityDynamicSqlSupport.machineScore, TbCompanyReliadbilityDynamicSqlSupport.reliability, TbCompanyReliadbilityDynamicSqlSupport.inputTime)
                .from(TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .where(TbCompanyReliadbilityDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbCompanyReliadbility record) {
        return UpdateDSL.updateWithMapper(this::update, TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .set(TbCompanyReliadbilityDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbCompanyReliadbilityDynamicSqlSupport.machineScore).equalTo(record::getMachineScore)
                .set(TbCompanyReliadbilityDynamicSqlSupport.reliability).equalTo(record::getReliability)
                .set(TbCompanyReliadbilityDynamicSqlSupport.inputTime).equalTo(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbCompanyReliadbility record) {
        return UpdateDSL.updateWithMapper(this::update, TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .set(TbCompanyReliadbilityDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbCompanyReliadbilityDynamicSqlSupport.machineScore).equalToWhenPresent(record::getMachineScore)
                .set(TbCompanyReliadbilityDynamicSqlSupport.reliability).equalToWhenPresent(record::getReliability)
                .set(TbCompanyReliadbilityDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbCompanyReliadbility record) {
        return UpdateDSL.updateWithMapper(this::update, TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .set(TbCompanyReliadbilityDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbCompanyReliadbilityDynamicSqlSupport.machineScore).equalTo(record::getMachineScore)
                .set(TbCompanyReliadbilityDynamicSqlSupport.reliability).equalTo(record::getReliability)
                .set(TbCompanyReliadbilityDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .where(TbCompanyReliadbilityDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbCompanyReliadbility record) {
        return UpdateDSL.updateWithMapper(this::update, TbCompanyReliadbilityDynamicSqlSupport.tbCompanyReliadbility)
                .set(TbCompanyReliadbilityDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbCompanyReliadbilityDynamicSqlSupport.machineScore).equalToWhenPresent(record::getMachineScore)
                .set(TbCompanyReliadbilityDynamicSqlSupport.reliability).equalToWhenPresent(record::getReliability)
                .set(TbCompanyReliadbilityDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .where(TbCompanyReliadbilityDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}